package me.spring.cloud.common.components.jest.page;

import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author luffy
 * @description: es分页
 * @date 2019-10-11 09:36
 */
@Data
@NoArgsConstructor
public class EsPage<T> extends EsSimplePage {

  private static final long serialVersionUID = 7461540139062266270L;

  /**
   * 当前页的数据
   */
  private List<T> list;

  public EsPage(int pageNo, int pageSize, int totalCount) {
    super(pageNo, pageSize, totalCount);
  }

  public EsPage(int pageNo, int pageSize, int totalCount, List<T> list) {
    super(pageNo, pageSize, totalCount);
    this.list = list;
  }

  public int getFirstResult() {
    return (pageNo - 1) * pageSize;
  }
}
